package com.sxfans.encryp.certificate;

import java.io.FileInputStream;
import java.io.InputStream;
import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.cert.Certificate;
import java.util.Enumeration;

public class CTest {
	public static void main(String[] args) throws Exception {
		String certificatePath = "D:\\Workspaces\\MyEclipse8.6\\ObjectFactory\\ObjectFactory\\certificate\\openssl\\server.p12";
		String keyStorePath = "D:\\Workspaces\\MyEclipse8.6\\ObjectFactory\\ObjectFactory\\certificate\\openssl\\server.p12";
		KeyStore ks = KeyStore.getInstance("PKCS12");
		InputStream is = new FileInputStream(keyStorePath);
		ks.load(is, "123456".toCharArray());
		is.close();
		Enumeration<String> em = ks.aliases();
		while(em.hasMoreElements())
		{
			System.out.println(em.nextElement());
		}
		System.out.println(ks.getKey("1","123456".toCharArray()));
	}
}
